#!/usr/bin/env python
# -*- coding: utf-8 -*-


import hashlib


class UserMgr():
    def __init__(self, app, session):
        self.app = app
        self.session = session
        self.users = {
            'admin': {
                'password': hashlib.md5('admin'.encode()).hexdigest(), 
                'name': '管理员', 
                'role': 'admin'
            },
            'tester': {
                'password': hashlib.md5('tester'.encode()).hexdigest(), 
                'name': '测试员', 
                'role': 'tester'
            },
        }


    def destroy(self):
        self.session = None
        self.app = None


    def __del__(self):
        self.destroy()


    def connect(self, request):
        self.app.logger.warning(f'{self.__class__}: method connect() is empty')

    
    def disconnect(self, request):
        self.app.logger.warning(f'{self.__class__}: method disconnect() is empty')


    